$(function() {
	doSearch();
});

function doSearch() {
	var startTime = $('#startTime').datebox('getValue');
	var mark = $('#mark').val();
	
	var trueNum = [];
	var falseNum = [];
	$.ajax({
		url : '/app/action/listData',
		data : {
			startTime : startTime,
			mark : mark
		},
		type : "POST",
		datatype : "json",
		async : true,
		success : function(data) {
			var yAxis = eval(data.yAxis);
			$.each(yAxis, function(index, mod) {
				trueNum.push(mod.trueNum);
				falseNum.push(mod.falseNum);
			});
			showHighChart(data.xAxis, trueNum, falseNum, data.mark);
		}
	});
}

function showHighChart (x, trueNum, falseNum, mark) {
	Highcharts.chart('container', {
	    title: {
	        text: mark +'行为统计'
	    },
	    xAxis: {
	        categories: x
	    },
	    series: [{
	        type: 'column',
	        name: '成功量',
	        data: trueNum
	    }, {
	        type: 'column',
	        name: '失败量',
	        data: falseNum
	    }]
	});
}
